﻿namespace Graph;

public class Edge : IComparable<Edge> //确保可排序
{
    public int A { get; } //顶点A
    public int B { get; } //顶点B
    public float W { get; } //边权值

    public Edge(int a, int b, float w)
    {
        A = a;
        B = b;
        W = w;
    }

    public int CompareTo(Edge other)
    {
        return W.CompareTo(other.W); 
    }

    public override string ToString()
    {
        return $"{A}-{B} : {W}";
    }
}
